<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="id" align="center" prop="id" />
       <el-table-column label="来源订单id" align="center" prop="sourceOrderId" />
      <el-table-column label="存货id" align="center" prop="inventoryId" />
      <el-table-column label="计量单位id" align="center" prop="unitId" />
      <el-table-column label="数量" align="center" prop="quantity" />
      <el-table-column label="单价" align="center" prop="price" />
      <el-table-column label="金额" align="center" prop="money" />
      <el-table-column label="货位id" align="center" prop="locationId" />
      <el-table-column label="批号" align="center" prop="batch" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="来源批号" align="center" prop="sourceBatch" />
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { Rdrecord11Api } from '@/api/wms/rdrecord11'

const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const props = defineProps<{
  orderId?: number // 订单id（主表的关联字段）
}>()
const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    list.value = await Rdrecord11Api.getRdrecords11ListByOrderId(props.orderId)
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
